Species distribution models (SDMs) are used to predict the habitat range of different organisms. They are useful as they can show us how changing environmental conditions affect how probable it is that a species occurs in a specific location. Knowing more about where species are likely to occur is useful for managing ecosystems, conserving species and predicting expected effects of climate change.
Species rarely stay in the same spot for long periods of time. Just like us, they react to changes in their environment and interactions with other species and with other individuals of their own species. As a result, it can be more useful to see how a distribution of a species changes over time. Particularly in marine environments where seemingly small changes in temperature, light or chemical composition can result in large changes in species distributions.
Here we will use a conservative SDM to predict the distribution of Nudibranchs around Australia, mapping monthly to look at seasonal changes. This post is inspired by Liam Bailey’s cool (and hilarious) Bigfoot distribution map and code which can be found here
SDM basics
Before we begin, it is important to first understand the basics behind SDMs. SDMs are built using different types of statistical models depending on the type and suitability of your data. However, in every SDM there are always 2 main inputs:
- Occurrence data
- Environmental variables
From this, the model predicts the probability of a species being found across a broader area. It takes the locations the species has already been found, then finds the associated environmental variables, and uses this to assess the suitability of the remaining area.
Having gone over the basics, let’s begin building our SDM of Nudibranchs across Australia.
Download and prepare data
First load the necessary packages.
library(dplyr) # Data wrangling
library(galah) # Download observations
library(stars) # Convert raster to easier format
library(ozmaps) # Australian map
library(SSDM) # Linear modelling
library(sdmpredictors) # Environmental variables
library(grDevices) # Colours and fonts
library(ggplot2) # Map plotting
library(maps) # Cities for mapExpand for session info
─ Session info ───────────────────────────────────────────────────────────────
setting value
version R version 4.2.2 (2022-10-31 ucrt)
os Windows 10 x64 (build 19044)
system x86_64, mingw32
ui RTerm
language (EN)
collate English_Australia.utf8
ctype English_Australia.utf8
tz Australia/Sydney
date 2023-02-20
pandoc 2.19.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
─ Packages ───────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
abind * 1.4-5 2016-07-21 [1] CRAN (R 4.2.0)
dplyr * 1.1.0 2023-01-29 [1] CRAN (R 4.2.2)
galah * 1.5.1 2023-01-13 [1] CRAN (R 4.2.2)
ggplot2 * 3.3.6 2022-05-03 [1] CRAN (R 4.2.1)
htmltools * 0.5.4 2022-12-07 [1] CRAN (R 4.2.2)
maps * 3.4.0 2021-09-25 [1] CRAN (R 4.2.1)
ozmaps * 0.4.5 2021-08-03 [1] CRAN (R 4.2.1)
sdmpredictors * 0.2.13 2022-09-13 [1] CRAN (R 4.2.1)
sessioninfo * 1.2.2 2021-12-06 [1] CRAN (R 4.2.1)
sf * 1.0-8 2022-07-14 [1] CRAN (R 4.2.1)
SSDM * 0.2.8 2020-02-28 [1] CRAN (R 4.2.1)
stars * 0.5-6 2022-07-21 [1] CRAN (R 4.2.1)
[1] C:/Users/KEL329/R-packages
[2] C:/Users/KEL329/AppData/Local/Programs/R/R-4.2.2/library
──────────────────────────────────────────────────────────────────────────────